home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / plnk081.zip / pilot-link.0.8.1 / include / pi-datebook.hxx < prev    next >
Text File  |  1997-05-23  |  6KB  |  234 lines

  1.  
  2. #include <sys/time.h>
  3. /*#include "pi-appinfo.h"
  4.  
  5. const int APPOINTMENT_APP_INFO_SIZE = 280;
  6.  
  7. class appointmentAppInfo_t : public appInfo_t
  8. {
  9.      int _startOfWeek;
  10.  
  11.    public:
  12.      appointmentAppInfo_t(void *);
  13.  
  14.      int startOfWeek(void) const { return _startOfWeek; }
  15.  
  16.      void *pack(void);
  17. };
  18.  
  19. class appointmentList_t;    // Forward declaration
  20.  
  21. class appointment_t : public baseApp_t
  22. {
  23.    public:
  24.      enum repeatType_t {
  25.       none, daily, weekly, monthlyByDay, monthlyByDate, yearly
  26.      };
  27.      enum alarmUnits_t {
  28.       minutes, hours, days
  29.      };
  30.  
  31.    private:
  32.      friend appointmentList_t;
  33.      
  34.      tm _begin;            // When the appointment begins
  35.      tm _end;            // When the appointment ends
  36.      int _untimed;
  37.  
  38.      int _hasAlarm;
  39.      int _advance;        // How far in advance the alarm should go off
  40.      alarmUnits_t _advanceUnits; // What _advance is measured in
  41.  
  42.      repeatType_t _repeatType;
  43.          
  44.      tm *_repeatEnd;
  45.      int _repeatFreq;
  46.      int _repeatOn;
  47.      int _repeatWeekstart;
  48.  
  49.      int _numExceptions;
  50.      tm *_exceptions;
  51.  
  52.      char *_description;
  53.      char *_note;
  54.  
  55.      appointment_t *_next;
  56.  
  57.      void *internalPack(unsigned char *);
  58.      
  59.    public:
  60.      appointment_t(void) : baseApp_t() {
  61.       (void) memset(this, '\0', sizeof(appointment_t));
  62.      }
  63.      appointment_t(void *buf) : baseApp_t() { unpack(buf, 1); }
  64.      appointment_t(void *buf, int attr, recordid_t id, int category)
  65.       : baseApp_t(attr, id, category)
  66.       {
  67.            unpack(buf, 1);
  68.       }
  69.      appointment_t(const appointment_t &);
  70.      
  71.      ~appointment_t(void) ;
  72.  
  73.      void unpack(void *, int = 0);
  74.  
  75.      void *pack(int *);
  76.      void *pack(void *, int *);
  77.      
  78.      tm *beginTime(void) { return &_begin; }
  79.      tm *endTime(void) { return &_end; }
  80.      int untimed(void) const { return _untimed; }
  81.      
  82.      int hasAlarm(void) const { return _hasAlarm; }
  83.      alarmUnits_t advanceUnits(void) const { return _advanceUnits; }
  84.      int advance(void) const { return _advance; }
  85.  
  86.      repeatType_t repeatType(void) const { return _repeatType; }
  87.      tm *repeatEnd(void) const { return _repeatEnd; }
  88.      int repeatFreq(void) const { return _repeatFreq; }
  89.      int repeatOn(void) const { return _repeatOn; }
  90.      int repeatWeekstart(void) const { return _repeatWeekstart; }
  91.  
  92.      int numExceptions(void) const { return _numExceptions; }
  93.      tm *exceptions(void) { return _exceptions; }
  94.      
  95.      const char *description(void) const { return _description; }
  96.      const char *note(void) const { return _note; }
  97.  
  98.      int operator==(const appointment_t &);
  99.      int operator<(const appointment_t &);
  100.      int operator>(const appointment_t &);
  101. };
  102.  
  103. class appointmentList_t 
  104. {
  105.      appointment_t *_head;
  106.      
  107.    public:
  108.      appointmentList_t(void) : _head(NULL) { }
  109.      ~appointmentList_t();
  110.      
  111.      appointment_t *first() { return _head; }
  112.      appointment_t *next(appointment_t *ptr) { return ptr->_next; }
  113.  
  114.      void merge(appointment_t &);
  115.      void merge(appointmentList_t &);
  116. };
  117. */
  118.  
  119. #include "pi-appinfo.hxx"
  120.  
  121. const int APPOINTMENT_APP_INFO_SIZE = 280;
  122.  
  123. class appointmentAppInfo_t : public appInfo_t
  124. {
  125.      int _startOfWeek;
  126.  
  127.    public:
  128.      appointmentAppInfo_t(void *);
  129.  
  130.      int startOfWeek(void) const { return _startOfWeek; }
  131.  
  132.      void *pack(void);
  133. };
  134.  
  135. class appointmentList_t;    // Forward declaration
  136.  
  137. class appointment_t : public baseApp_t
  138. {
  139.    public:
  140.      enum repeatType_t {
  141.       none, daily, weekly, monthlyByDay, monthlyByDate, yearly
  142.      };
  143.      enum alarmUnits_t {
  144.       minutes, hours, days
  145.      };
  146.  
  147.    private:
  148.      friend appointmentList_t;
  149.      
  150.      tm _begin;            // When the appointment begins
  151.      tm _end;            // When the appointment ends
  152.      int _untimed;
  153.  
  154.      int _hasAlarm;
  155.      int _advance;        // How far in advance the alarm should go off
  156.      alarmUnits_t _advanceUnits; // What _advance is measured in
  157.  
  158.      repeatType_t _repeatType;
  159.          
  160.      tm *_repeatEnd;
  161.      int _repeatFreq;
  162.      int _repeatOn;
  163.      int _repeatWeekstart;
  164.  
  165.      int _numExceptions;
  166.      tm *_exceptions;
  167.  
  168.      char *_description;
  169.      char *_note;
  170.  
  171.      appointment_t *_next;
  172.  
  173.      void *internalPack(unsigned char *);
  174.      
  175.    public:
  176.      appointment_t(void) : baseApp_t() {
  177.       (void) memset(this, '\0', sizeof(appointment_t));
  178.      }
  179.      appointment_t(void *buf) : baseApp_t() { unpack(buf, 1); }
  180.      appointment_t(void *buf, int attr, recordid_t id, int category)
  181.       : baseApp_t(attr, id, category)
  182.       {
  183.            unpack(buf, 1);
  184.       }
  185.      appointment_t(const appointment_t &);
  186.      
  187.      ~appointment_t(void) ;
  188.  
  189.      void unpack(void *, int = 0);
  190.  
  191.      void *pack(int *);
  192.      void *pack(void *, int *);
  193.      
  194.      tm *beginTime(void) { return &_begin; }
  195.      tm *endTime(void) { return &_end; }
  196.      int untimed(void) const { return _untimed; }
  197.      
  198.      int hasAlarm(void) const { return _hasAlarm; }
  199.      alarmUnits_t advanceUnits(void) const { return _advanceUnits; }
  200.      int advance(void) const { return _advance; }
  201.  
  202.      repeatType_t repeatType(void) const { return _repeatType; }
  203.      tm *repeatEnd(void) const { return _repeatEnd; }
  204.      int repeatFreq(void) const { return _repeatFreq; }
  205.      int repeatOn(void) const { return _repeatOn; }
  206.      int repeatWeekstart(void) const { return _repeatWeekstart; }
  207.  
  208.      int numExceptions(void) const { return _numExceptions; }
  209.      tm *exceptions(void) { return _exceptions; }
  210.      
  211.      const char *description(void) const { return _description; }
  212.      const char *note(void) const { return _note; }
  213.  
  214.      int operator==(const appointment_t &);
  215.      int operator<(const appointment_t &);
  216.      int operator>(const appointment_t &);
  217. };
  218.  
  219. class appointmentList_t 
  220. {
  221.      appointment_t *_head;
  222.      
  223.    public:
  224.      appointmentList_t(void) : _head(NULL) { }
  225.      ~appointmentList_t();
  226.      
  227.      appointment_t *first() { return _head; }
  228.      appointment_t *next(appointment_t *ptr) { return ptr->_next; }
  229.  
  230.      void merge(appointment_t &);
  231.      void merge(appointmentList_t &);
  232. };
  233.  
  234.